package com.homson.coreservice.servicecommon.response;


import com.homson.coreservice.servicecommon.enumeration.BaseCodeEnum;

import static com.homson.coreservice.servicecommon.enumeration.ResponseCodeEnum.*;

/**
 * @author: homson_leo
 * @contact: hey_超级巨星（Homson_Leo）- 刘泓岑 1196816884@qq.com
 * @time: 2025/10/4 1:05 PM
 **/
public class EntityResponse<T> extends AbstractResponse{
    private T data;
    
    public EntityResponse(BaseCodeEnum code, String message, T data){
        super(code,message);
        this.data= data;
    }
    public EntityResponse() {
    }
    
    public T getData() {
        return data;
    }
    
    public void setData(T data) {
        this.data = data;
    }
    
    @Override
    public String toString() {
        return "BaseResponse{" +
                "data=" + data +
                '}';
    }
    
    public static EntityResponse ok(Object data){
        return new EntityResponse<>(SUCCESS,"success",data);
    }
    public static EntityResponse fail(String msg){
        return new EntityResponse<>(ERROR,msg,null);
    }
}
